package top.continew.admin.controller.business;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.DesensitizedUtil;
import cn.shengchao.examstar.rpc.base.PageResult;
import cn.shengchao.examstar.rpc.distribute.DistributeUserInviteApi;
import cn.shengchao.examstar.rpc.distribute.dto.UserInviteDto;
import cn.shengchao.examstar.rpc.student.api.IStudentRpc;
import cn.shengchao.examstar.rpc.student.req.StudentQueryPage;
import cn.shengchao.examstar.rpc.student.res.StudentList;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;
import top.continew.starter.web.model.R;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Tag(name = "学员 API")
@RestController
@RequestMapping("/student")
public class StudentController {
    @DubboReference
    private IStudentRpc iStudentRpc;
    @DubboReference
    private DistributeUserInviteApi distributeUserInviteApi;

    @GetMapping
    @Operation(summary = "学员列表", description = "学员列表")
    public PageResult<StudentList> getStudent(StudentQueryPage studentQueryPage) {
        PageResult<StudentList> pageResult = iStudentRpc.getStudentList(studentQueryPage);
        return pageResult;
    }

    @PutMapping("{studentId}/status")
    @Operation(summary = "更新状态", description = "更新状态")
    public R updateMember(@PathVariable Long studentId) {
        iStudentRpc.changeStatus(studentId);
        return R.ok();
    }

}
